package com.cz.ssyx.order.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cz.ssyx.common.result.Result;
import com.cz.ssyx.model.order.OrderInfo;
import com.cz.ssyx.order.service.OrderInfoService;
import com.cz.ssyx.vo.order.OrderQueryDTO;
import com.cz.ssyx.vo.order.OrderUserQueryVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 功能描述:
 *
 * @author: 程长
 * @date: 2025/3/4 10:47
 * @version: 1.0
 */
@RestController
@RequestMapping("/admin/order")
public class AdminOrderController {

    @Resource
    private OrderInfoService orderInfoService;

    //查询订单
    @GetMapping("/orderInfo/{page}/{limit}")
    public Result getOrderPage(@PathVariable Long page, @PathVariable Long limit, OrderQueryDTO orderQueryDTO) {
        Page<OrderInfo> orderInfoPage = new Page<>(page, limit);
        IPage<OrderInfo> pageModel = orderInfoService.getOrderPageByQuery(orderInfoPage, orderQueryDTO);
        return Result.ok(pageModel);
    }

    @GetMapping("/orderInfo/get/{id}")
    public Result<OrderInfo> getOrderPageById(@PathVariable Long id) {
        return Result.ok(orderInfoService.getOrderInfoById(id));
    }

}
